<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<link rel="stylesheet" href="/boke/Public/bs/css/bootstrap.css">
	<script src="/boke/Public/bs/js/jquery.min.js"></script>
	<script src="/boke/Public/bs/js/bootstrap.min.js"></script>
	<script src="/boke/Public/admin/js/index.js"></script>
	<script src="/boke/Public/js/jquery.js"></script>
	<link rel="stylesheet" href="/boke/Public/admin/css/index.css">
</head>
<body>
	<div class="page-header">
	  <center><h1>Background management system <small>后台管理</small></h1></center>
	</div>
	<!-- 内容 -->
	<div class="container-fluid">
		<div class="row">
			<!-- 左侧 -->
		  <div class="col-md-2 left-head">
		  	<!-- 系统管理 -->
		  	<div class="panel panel-success Sys_mod">
			  <div class="panel-heading">系统管理</div>
			  <ul class="list-group">
			    <li class="list-group-item"><a href="<?php echo U('Sys/index');?>">轮播图设置</a></li>
			    <li class="list-group-item">Dapibus ac facilisis in</li>
			    <li class="list-group-item">Morbi leo risus</li>
			    <li class="list-group-item">Porta ac consectetur ac</li>
			    <li class="list-group-item">Vestibulum at eros</li>
			  </ul>
			</div>
			<div class="panel panel-success">
			  <div class="panel-heading">系统管理</div>
			  <ul class="list-group">
			    <li class="list-group-item">Cras justo odio</li>
			    <li class="list-group-item">Dapibus ac facilisis in</li>
			    <li class="list-group-item">Morbi leo risus</li>
			    <li class="list-group-item">Porta ac consectetur ac</li>
			    <li class="list-group-item">Vestibulum at eros</li>
			  </ul>
			</div>
		  </div>
		  <div class="col-md-10">
		  	
<link rel="stylesheet" href="/boke/Public/plugin/uploadify/uploadify.css">
<script src='/boke/Public/plugin/uploadify/jquery.min.js'></script>
<script src='/boke/Public/plugin/uploadify/jquery.uploadify.min.js'></script>
<div>
	<ol class="breadcrumb">
	  <li><a href="#">后台管理</a></li>
	  <li><a href="#">系统管理</a></li>
	  <li class="active">轮播图管理</li>
	</ol>
	<div class="alert alert-success" role="alert">
		<button type="button" class="btn btn-success" data-toggle="modal" data-target="#myModal">
  添加
</button>
		<a href="" class="btn btn-danger">批量删除</a>
	</div>

	<table class="table table-bordered table-hover">
		<tr>
			<td><input type="checkbox"></td>
			<td>名称</td>
			<td>图片</td>
			<td>排序</td>
			<td>是否显示</td>
			<td>操作</td>
		</tr>
		<?php if(is_array($data)): $i = 0; $__LIST__ = $data;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$lunbo_list): $mod = ($i % 2 );++$i;?><tr>
				<td><input type="checkbox" id="id[<?php echo ($lunbo_list["id"]); ?>]"></td>
				<td><?php echo ($lunbo_list["lb_name"]); ?></td>
				<td><img src="/boke/UPLOADS<?php echo ($lunbo_list["lb_url"]); ?>" alt="" width="300px"></td>
				<td><input type="text" class=""></td>
				<td>是</td>

				<td>
					<a href="">修改</a>
					<a href="">删除</a>
				</td>
			</tr><?php endforeach; endif; else: echo "" ;endif; ?>
		
	</table>



	<!-- Modal -->
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
	  <div class="modal-dialog" role="document">
	    <div class="modal-content">
	      <div class="modal-header">
	        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
	        <h4 class="modal-title" id="myModalLabel">添加轮播图</h4>
	      </div>
	      <div class="modal-body">
	        <form action="">
				<div class="input-group">
				  <span class="input-group-addon" id="basic-addon3">名称</span>
				  <input type="text" class="form-control" id="lb_name" aria-describedby="basic-addon3">
				</div>
				<div class="input-group">
				  <div id="imgs"></div>
					<input type="hidden" id="lb_url">
        		  <input id="file_upload" name="file_upload" type="file" multiple="true" value="" />
				</div>
	        </form>
	      </div>
	      <div class="modal-footer">
	        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
	        <button type="button" class="btn btn-primary" id="submit">确认添加</button>
	      </div>
	    </div>
	  </div>
	</div>
</div>
<script>
        var img = '';
		$('#file_upload').uploadify({
	        	'swf'      : '/boke/Public/plugin/uploadify/uploadify.swf',
	        	'uploader' : '<?php echo U("Sys/upload");?>',   //上传的方法
	        	'buttonText' : '缩略图上传',
	        	onUploadSuccess : function(file, data, response) {
	        	 //把所有上传的图片都放入DIV中
                 alert(data);
                 $("#lb_url").val(data);
	        	 img += "<img width='200px' src='/boke/Uploads/"+data+"'>";
	            $('#imgs').html(img);
        	}
    	});
    	$("#submit").click(function(){
    		lb_url=$("#lb_url").val();	
    		lb_name=$("#lb_name").val();
    		$.ajax({
    			url:'<?php echo U("Sys/savelb");?>',
    			data:{lb_url:lb_url,lb_name:lb_name},
    			type:"POST",
    			success:function(data){
    				if(data==1){

    				}
    			}
    		})
    	})
</script>
		  </div>	  
		</div>
	</div>
</body>
</html>
<script>
$(function(){
	$(".left-head .panel-heading").click(function(){
		show_dispaly=$(this).siblings(".list-group").css("display");
		isshow=$(this).siblings(".list-group");
		if (show_dispaly=="none"){
			isshow.show("fast");
		}else{
			isshow.hide("fast");
		}
	})
	$(".<?php echo (CONTROLLER_NAME); ?>_mod>.panel-heading").click();
	

})
	
</script>